package com.hp.modules.sys.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.hp.common.annotation.DictEnum;
import com.hp.common.base.CodedEnum;
import com.hp.common.base.YesNoEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import tk.mybatis.mapper.annotation.LogicDelete;

import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * @author:mcfan
 * @description:sys_notice
 * @date: create in 16:11 2021/4/7
 */
@Table(name = "sys_notice")
@ApiModel(description = "")
public class SysNotice implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = -1L;
    @Id
    @ApiModelProperty(value = "编号")
    private Long id;
    @ApiModelProperty(value = "公告标题")
    private String title;
    @ApiModelProperty(value = "公告类型(10->通知|TZ,20->公告|GG)")
    private TypeEnum type;
    @ApiModelProperty(value = "公告内容")
    private String content;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    @ApiModelProperty(value = "是否删除(1->未删除|NO,2->已删除|YES)")
    @LogicDelete(isDeletedValue=YesNoEnum.Y,notDeletedValue=YesNoEnum.N)
    private YesNoEnum isDeleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public TypeEnum getType() {
        return type;
    }

    public void setType(TypeEnum type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public YesNoEnum getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(YesNoEnum isDeleted) {
        this.isDeleted = isDeleted;
    }

    @DictEnum(key = "sys_notice_type",name = "公告类型")
    public enum TypeEnum implements CodedEnum{
        /**
         * 通知
         */
        TZ(10,"通知"),
        /**
         * 公告
         */
        GG(20,"公告");

        private int value;
        private String name;
        @JsonCreator
        public static TypeEnum forValue(int value){
            return CodedEnum.codeOf(TypeEnum.class,value).get();
        }

        TypeEnum(int value, String name) {
            this.value = value;
            this.name = name;
        }



        @Override
        @JsonValue
        public int getValue() {
            return value;
        }

        @Override
        public String getName() {
            return name;
        }
    }
}
